<?php
// +----------------------------------------------------------------------
// | IPHP
// +----------------------------------------------------------------------
// | This is an open source and simple PHP FrameWork.
// +----------------------------------------------------------------------
// | Author: wuzhuo
// +----------------------------------------------------------------------

// sae的存储

namespace IPHP\Storage;

class Local {

    // 构造方法
    public function __contruct() {

    }

    /**
     * 设置
     */
    public function set($dir,$filename,$content){
        if(!is_dir($dir)) {
            mkdir($dir,0755,1);
        }
        file_put_contents($filename,$content);
    }

    /**
     * 获取
     * @return [type] [description]
     */
    public function get($filename){
        return file_get_contents($filename);
    }

    /**
     * 删除
     * @return [type] [description]
     */
    public function delete($filename) {
        return is_file($filename) ? unlink($filename) : false;
    }

    /**
     * 检查文件是否存在
     * @return [type] [description]
     */
    public function exists($filename) {
        return is_file($filename) ? true : false;
    }

    /**
     * 获取文件信息
     * @return [type] [description]
     */
    public function info() {
        $info['mtime'] = fileatime($cf);

        return $info;
    }
}